<?#//v.3.0.0

#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";
//-- Set offset and limit for pagination
$limit = 20;
if(!$offset) $offset = 0;
$_SESSION['RETURN_LIST'] = 'listsuspendedauctions.php';
$_SESSION['RETURN_LIST_OFFSET'] = intval($_GET['offset']);

?>
<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</HEAD>
<?    require('../includes/styles.inc.php'); ?>
</HEAD>
<bodyleftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/auction_icon2.gif" width="31" height="25" ></td>
          <td class="breadcrumbs"><p><span><?=$MSG_239?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG_5227?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">
<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0" class="base" ALIGN="CENTER" style="border:1px solid #ccc;">
<TR>
  <TD ALIGN=CENTER class=title><p><? print $MSG_5227; ?></p></TD>
</TR>
<TR>
  <TD><TABLE WIDTH=100% CELPADDING=0 CELLSPACING=1 BORDER=0 ALIGN="CENTER" CELLPADDING="3">
      <?
      $query = "select count(id) as auctions from PHPAUCTIONXL_auctions WHERE suspended<>0 ";
      $result = mysql_query($query);
      if(!$result){
      	print "$ERR_001<BR>$query<BR>".mysql_error();
      	exit;
      }
      $num_auctions = mysql_result($result,0,"auctions");
      print "<TR BGCOLOR=#FFFFFF><TD COLSPAN=7><B>
				$num_auctions $MSG_311</B></TD></TR>";
	?>
      <TR BGCOLOR="#FFFFC0">
        <TD ALIGN=CENTER> <B> <? print $MSG_312; ?> </B>  </TD>
        <TD ALIGN=CENTER> <B> <? print $MSG_313; ?> </B>  </TD>
        <TD ALIGN=CENTER> <B> <? print $MSG_314; ?> </B>  </TD>
                <TD ALIGN=LEFT> <B> <? print $MSG_316; ?> </B>  </TD>
        <TD ALIGN=LEFT> <B> <? print $MSG_317; ?> </B>  </TD>
        <TD ALIGN=LEFT> <B> <? print $MSG_297; ?> </B>  </TD>
	</tr>	
        <?
        $query = "SELECT a.*,u.*,c.*
					FROM
					PHPAUCTIONXL_auctions a,
					PHPAUCTIONXL_users u,
					PHPAUCTIONXL_categories c
					WHERE
					u.id = a.user AND
					c.cat_id = a.category AND
					a.suspended<>'0'
					group by a.id ORDER BY u.nick limit $offset, $limit";
        $result = mysql_query($query);
        if(!$result){
        	print "Database access error: abnormal termination<BR>$query<BR>".mysql_error();
        	exit;
        }
        $num_auction = mysql_num_rows($result);
        $i = 0;
        $bgcolor = "#FFFFFF";
        while($i < $num_auction){
        	if($bgcolor == "#FFFFFF") {
        		$bgcolor = "#EEEEEE";
        	}else{
        		$bgcolor = "#FFFFFF";
        	}
        	$id = mysql_result($result,$i,"id");
        	$title = stripslashes(mysql_result($result,$i,"title"));
        	$nick = mysql_result($result,$i,"nick");
        	$tmp_date = mysql_result($result,$i,"starts");
        	//$duration = mysql_result($result,$i,"duration");
        	$category = mysql_result($result,$i,"cat_name");
        	$description = strip_tags(stripslashes(mysql_result($result,$i,"description")));
        	$suspended = mysql_result($result,$i,"suspended");
        	$refund = mysql_result($result,$i,"refund");
        	$day = substr($tmp_date,6,2);
        	$month = substr($tmp_date,4,2);
        	$year = substr($tmp_date,0,4);
        	$date = "$day/$month/$year";
        	
        	print "<TR BGCOLOR=$bgcolor>
					<TD>";
        	if($suspended == 1) {
        		print "<FONT COLOR=red><B>$title</B>";
        	} else {
        		print $title;
        	}
        	print "
						</TD>
						<TD>
						".$nick."
						
						</TD>
						<TD>
						".$date."
						
						</TD>
						<TD>
						$category
						
						</TD>
						<TD>
						$description
						
						</TD>
						<TD ALIGN=LEFT>
						<!-- <A HREF=\"editauction.php?id=$id&offset=$offset\" class=\"nounderlined\">$MSG_298</A><BR> -->
						<A HREF=\"deleteauction.php?id=$id&offset=$offset\" class=\"nounderlined\">$MSG_299</A><BR>";
					
              if($refund == 0 ) {
          
          print "<A HREF=\"refund_bids_for_an_entire_auction.php?id=$id\" class=\"nounderlined\">$MSG_AJAX_ADMIN_AUCTION_REFUND_BIDS_FOR_AUCTION2</A><BR>";
						               }
						               if($refund == 1 ) {
          
          print "<font color=red >$MSG_AJAX_ADMIN_AUCTION_REFUND_BIDS_FOR_AUCTION3</font><BR>";
						               }
						               
            print "<A HREF=\"excludeauction.php?id=$id&offset=$offset\" class=\"nounderlined\">";
        	if($suspended == 0) {
        		print $MSG_300;
        	} else {
        		print $MSG_310;
        	}
        	print "</A><BR>
						</TD>
						<TR>";
        	
        	$i++;
        }
        ?>
        </TABLE>
		<?
        //-- Build navigation line
        print "<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0 ALIGN=CENTER>
			   <TR ALIGN=CENTER BGCOLOR=#FFFFFF>
			   <TD COLSPAN=2>";
        print "<SPAN CLASS=\"navigation\">";
        $num_pages = ceil($num_auctions / $limit);
        $i = 0;
        while($i < $num_pages ){
        	$of = ($i * $limit);
        	if($of != $offset){
        		print "<A HREF=\"listsuspendedauctions.php?offset=$of\" CLASS=\"navigation\">".($i + 1)."</A>";
        		if($i != $num_pages) print " | ";
        	}else{
        		print $i + 1;
        		if($i != $num_pages) print " | ";
        	}
        	$i++;
        }
        print "</SPAN></TR></TD></TABLE>";
	  ?></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>